package com.kylin.module.community.forms;

import java.util.Date;
import java.text.SimpleDateFormat;
import java.text.ParseException;

import org.apache.struts.action.ActionForm;
import org.apache.struts.upload.FormFile;

public class MemberForm extends ActionForm {

     private static final long serialVersionUID = 1L;
    // Fields    
     private Long id;
	 private String  username;
	 private String  password;
	 private String  email;
	 private String  name;
	 private Short  userrole;     
	 private Short  sex;
	 private String  country;
	 private String  birthday;
	 private String  city;
	 private String  introduce;
	 private FormFile  imgFile;  /*  form file */
	 private String  targetlang;
	 private String  language;
	 private String  createdby;
	 private Date  createdon;
	 private String  lastupdatedby;
	 private Date  lastupdatedon;
	 private Short  active;
	 private Integer  ordering;
	 private Integer  hits;
	 
     private Long userid;
     private Long interestid;
   
    // Property accessors
    
    public Long getId() {
        return this.id;
    }
    
    public void setId(Long id) {
        this.id = id;
    }
    public String getUsername() {
        return this.username;
    }
    
    public void setUsername(String username) {
        this.username = username;
    }
    public String getPassword() {
        return this.password;
    }
    
    public void setPassword(String password) {
        this.password = password;
    }
    public String getEmail() {
        return this.email;
    }
    
    public void setEmail(String email) {
        this.email = email;
    }
    public String getName() {
        return this.name;
    }
    
    public void setName(String name) {
        this.name = name;
    }
    public Short getUserrole() {
        return this.userrole;
    }
    
    public void setUserrole(Short userrole) {
        this.userrole = userrole;
    }

    
    public Short getSex() {
        return this.sex;
    }
    
    public void setSex(Short sex) {
        this.sex = sex;
    }
    public String getCountry() {
        return this.country;
    }
    
    public void setCountry(String country) {
        this.country = country;
    }
	public String getBirthday() {
		return birthday;
	}

	public void setBirthday(String birthday) {		
		this.birthday = birthday;
	}	
	
	public Date getDateBirthday() {
		
		SimpleDateFormat sDateFormat = new SimpleDateFormat("yyyy-MM-dd");
		//String dateStringToParse = this.birthday;//getBirthday();
			
		try{
			return sDateFormat.parse(this.birthday);
		}catch (ParseException pe) {
			return null;
		}
		//this.birthday = birthday;
	}
    public String getCity() {
        return this.city;
    }
    
    public void setCity(String city) {
        this.city = city;
    }
    public String getIntroduce() {
        return this.introduce;
    }
    
    public void setIntroduce(String introduce) {
        this.introduce = introduce;
    }
 
    public String getTargetlang() {
        return this.targetlang;
    }
    
    public void setTargetlang(String targetlang) {
        this.targetlang = targetlang;
    }
    public String getLanguage() {
        return this.language;
    }
    
    public void setLanguage(String language) {
        this.language = language;
    }
    public String getCreatedby() {
        return this.createdby;
    }
    
    public void setCreatedby(String createdby) {
        this.createdby = createdby;
    }
    public Date getCreatedon() {
        return this.createdon;
    }
    
    public void setCreatedon(Date createdon) {
        this.createdon = createdon;
    }
    public String getLastupdatedby() {
        return this.lastupdatedby;
    }
    
    public void setLastupdatedby(String lastupdatedby) {
        this.lastupdatedby = lastupdatedby;
    }
    public Date getLastupdatedon() {
        return this.lastupdatedon;
    }
    
    public void setLastupdatedon(Date lastupdatedon) {
        this.lastupdatedon = lastupdatedon;
    }
    public Short getActive() {
        return this.active;
    }
    
    public void setActive(Short active) {
        this.active = active;
    }
    public Integer getOrdering() {
        return this.ordering;
    }
    
    public void setOrdering(Integer ordering) {
        this.ordering = ordering;
    }
    public Integer getHits() {
        return this.hits;
    }
    
    public void setHits(Integer hits) {
        this.hits = hits;
    }

	
	// parent table: User
	
    public Long getUserid() {
		return userid;
	}

	public void setUserid(Long userid) {
		this.userid = userid;
	}
	
	
	// parent table: Interest
	
    public Long getInterestid() {
		return interestid;
	}

	public void setInterestid(Long interestid) {
		this.interestid = interestid;
	}
	
	
	public FormFile getImgFile() {
		return imgFile;
	}
	public void setImgFile(FormFile imgFile) {
		this.imgFile = imgFile;
	}	
		
	public String toString(){
		StringBuffer sb = new StringBuffer();
		sb.append("\n username   =" + username );
		sb.append("\n password   =" + password );
		sb.append("\n email   =" + email );
		sb.append("\n name   =" + name );
		sb.append("\n userrole   =" + userrole );		
		sb.append("\n sex   =" + sex );
		sb.append("\n country   =" + country );
		sb.append("\n birthday   =" + birthday );
		sb.append("\n city   =" + city );
		sb.append("\n introduce   =" + introduce );
		sb.append("\n imgurl   =" + imgFile );
		sb.append("\n targetlang   =" + targetlang );
		sb.append("\n language   =" + language );
		sb.append("\n createdby   =" + createdby );
		sb.append("\n createdon   =" + createdon );
		sb.append("\n lastupdatedby   =" + lastupdatedby );
		sb.append("\n lastupdatedon   =" + lastupdatedon );
		sb.append("\n active   =" + active );
		sb.append("\n ordering   =" + ordering );
		sb.append("\n hits   =" + hits );

  	  sb.append("\n userid = " + userid );	
  	  sb.append("\n interestid = " + interestid );	
		return sb.toString();
	}		
		
}